//
//  ComButtomView.m
//  SinaWebo
//
//  Created by wwj on 16/1/11.
//  Copyright © 2016年 亦心. All rights reserved.
//

#import "ComButtomView.h"

@interface ComButtomView ()
@property (weak, nonatomic) IBOutlet UIButton *cancelBtn;

@end

@implementation ComButtomView

+(instancetype)comButtomView{
    ComButtomView *view = [[NSBundle mainBundle] loadNibNamed:@"ComButtomView" owner:nil options:nil].lastObject;
    [UIView animateWithDuration:0.3 animations:^{
        view.cancelBtn.transform = CGAffineTransformRotate(view.cancelBtn.transform, M_PI/4);
    }];
    
    return view;
}

-(void)awakeFromNib{
    _cancelBtn.transform = CGAffineTransformMakeRotation(M_PI/4);
}

-(void)setFrame:(CGRect)frame{
    frame.size.height = 44;
    [super setFrame:frame];
}

- (IBAction)onClickBtn {
    [UIView animateWithDuration:0.3 animations:^{
        _cancelBtn.transform = CGAffineTransformRotate(_cancelBtn.transform, -M_PI/4);
    }];
    
    if (_onClickCancelBtn) {
        _onClickCancelBtn();
        
    }
}

@end
